﻿using B.S.DataBase.MyProject.Domain.Sales;
using B.S.DataBase.MyProject.Domain.ViewModels;
using B.S.DataBase.MyProject.ErrorCode;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

using T.E.ERP.Read.API.Applicantions.Command.SaleOrderInfoCommand;

namespace T.E.ERP.Read.API.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class SaleOrderController : ControllerBase
    {   
        private readonly IMediator mediator;
        public SaleOrderController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 获取销售订单列表
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<APIResult<List<View_SaleOrderInfo>>> GetSaleOrderList([FromQuery] GetSaleOrderInfoListCommand request)
        {
            return mediator.Send(request);
        }
        /// <summary>
        /// 获取销售订单明细
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<APIResult<Viw_SaleOrderDetail>> GetSaleOrderDetail([FromQuery] GetSaleOrderDetailCommand request)
        {
            return mediator.Send(request);
        }
    }
}
